A view over data. More...
Public Member Functions | |
BufferView () | |
BufferView (T *data, unsigned long long size) | |
BufferView (const Buffer &buffer) | |
BufferView (const Buffer &buffer, unsigned long long index, unsigned long long length=0) | |
BufferView (Buffer &&buffer)=delete | |
~BufferView ()=default | |
T * | getData () const |
unsigned long long | getSize () const |
bool | empty () const |
T & | front () |
const T & | front () const |
T & | back () |
const T & | back () const |
BufferView< T > | subView (unsigned long long index, unsigned long long length=0) const |
T & | operator[] (unsigned long long index) |
const T & | operator[] (unsigned long long index) const |
template<typename U > | |
BufferView (BufferCast< U > &bufferCast) | |
BufferView (BufferCast< T > &bufferCast) | |
template<typename U > | |
BufferView (const BufferView< U > &view) | |
BufferView (const BufferView< T > &view) | |
template<typename U , std::size_t S> | |
BufferView (std::array< U, S > &array) | |
template<std::size_t S> | |
BufferView (std::array< T, S > &array) | |
template<typename U > | |
BufferView (std::vector< U > &vec) | |
BufferView (std::vector< T > &vec) | |
template<typename U , std::size_t S, typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::array< U, S > &array) | |
template<std::size_t S, typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::array< typename std::remove_const< T >::type, S > &array) | |
template<typename U , typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::vector< U > &vec) | |
template<typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::vector< typename std::remove_const< T >::type > &vec) | |
A view over data.
Behaves like the BufferCast, but not considered as owner of the memory. This means this variant of the buffer is a good candidate when exchanging data, as it doesn't copy anything but only offers a view over it.
It also allows to cast the data, and alter the way it is intepreted.
nkMemory::BufferView< T >::BufferView | ( | ) |
Default constructor. Creates an empty view.
nkMemory::BufferView< T >::BufferView | ( | T * | data, |
unsigned long long | size | ||
) |
Raw data constructor. This will make the view point to the data provided.
data | The data to point to. |
size | The size of the data provided. |
nkMemory::BufferView< T >::BufferView | ( | const Buffer & | buffer | ) |
Buffer constructor. Offers a view over the data of a buffer.
buffer | The buffer which memory has to be pointed. |
nkMemory::BufferView< T >::BufferView | ( | const Buffer & | buffer, |
unsigned long long | index, | ||
unsigned long long | length = 0 |
||
) |
Buffer sub-part constructor. Offers a view over a sub-part of a buffer.
buffer | The buffer which memory has to be pointed. |
index | The starting offset, in number of elements T, at which the view should start. |
length | The number of elements T the sub-view should have. |
|
delete |
This destructor is deleted, as a Buffer&& will clean up its memory right after assignment. This is unsafe as the new view's memory will be invalid.
buffer | The rvalue buffer. |
|
default |
Destructor. This variant of the buffer classes will not delete the data pointer on destruction.
nkMemory::BufferView< T >::BufferView | ( | BufferCast< U > & | bufferCast | ) |
Utility constructor over casts of different type.
bufferCast | The buffer cast which data should be pointed. |
nkMemory::BufferView< T >::BufferView | ( | BufferCast< T > & | bufferCast | ) |
Utility constructor over casts of the same type.
bufferCast | The buffer cast which data should be pointed. |
nkMemory::BufferView< T >::BufferView | ( | const BufferView< U > & | view | ) |
Utility constructor over a view of another type, reinterpreting the data.
view | The view to reinterpret. |
nkMemory::BufferView< T >::BufferView | ( | const BufferView< T > & | view | ) |
Utility copy constructor.
view | The view to copy. |
nkMemory::BufferView< T >::BufferView | ( | std::array< U, S > & | array | ) |
Utility constructor over an array which memory will be reinterpreted to another type.
array | The array which data should be referenced. |
nkMemory::BufferView< T >::BufferView | ( | std::array< T, S > & | array | ) |
Utility constructor over an array.
array | The array which data should be referenced. |
nkMemory::BufferView< T >::BufferView | ( | std::vector< U > & | vec | ) |
Utility constructor over a vector which memory will be reinterpreted to another type.
vec | The vector which data should be reinterpreted. |
nkMemory::BufferView< T >::BufferView | ( | std::vector< T > & | vec | ) |
Utility constructor over vectors.
vec | The vector which data should be referenced. |
nkMemory::BufferView< T >::BufferView | ( | const std::array< U, S > & | array | ) |
Utility reinterpreting constructor over a const array.
array | The array which data should be reinterpreted. |
nkMemory::BufferView< T >::BufferView | ( | const std::array< typename std::remove_const< T >::type, S > & | array | ) |
Utility reinterpreting constructor over a const array.
array | The array which data should be referenced. |
nkMemory::BufferView< T >::BufferView | ( | const std::vector< U > & | vec | ) |
Utility reinterpreting constructor over a const vector.
vec | The vector which data should be reinterpreted. |
nkMemory::BufferView< T >::BufferView | ( | const std::vector< typename std::remove_const< T >::type > & | vec | ) |
Utility vector constructor, const version.
vec | The vector which data should be referenced. |
T* nkMemory::BufferView< T >::getData | ( | ) | const |
unsigned long long nkMemory::BufferView< T >::getSize | ( | ) | const |
bool nkMemory::BufferView< T >::empty | ( | ) | const |
T& nkMemory::BufferView< T >::front | ( | ) |
const T& nkMemory::BufferView< T >::front | ( | ) | const |
T& nkMemory::BufferView< T >::back | ( | ) |
const T& nkMemory::BufferView< T >::back | ( | ) | const |
BufferView<T> nkMemory::BufferView< T >::subView | ( | unsigned long long | index, |
unsigned long long | length = 0 |
||
) | const |
Allows to create a view over a subpart of current view.
index | The new view's starting element's index. |
length | The new view's length, from starting element. If 0, it will default to current view's ending point. |
T& nkMemory::BufferView< T >::operator[] | ( | unsigned long long | index | ) |
Indexing operator.
index | The index of the element to index in the memory. |
const T& nkMemory::BufferView< T >::operator[] | ( | unsigned long long | index | ) | const |
Indexing operator, const versioned.
index | The index of the element to index in the memory. |